import os
import web
import time
import redis

urls = (
    '/visit_sec_check', 'Handle'
)



class Handle(object):
    def GET(self):
        visitkey = time.strftime('visit%Y_%m_%d')
        redisobj = redis.Redis()

        rip = web.ctx.environ['REMOTE_ADDR']
        redisobj.zincrby(visitkey, rip, 1)
        redisobj.zincrby('visittotal', rip, 1)
        return 'safe'


app = web.application(urls, globals())

if __name__ == "__main__":
    app.run()

